package yl.hs.bmipfull.controllers.construction;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import yl.hs.bmipfull.controllers.ControllerBase;
import yl.hs.bmipfull.service.finance.IShipSettleService;
import yl.hs.bmipfull.viewmodels.PageQuery;
import yl.hs.bmipfull.viewmodels.WebResult;

/**
 * @author 谢东
 * @apiNote 工地结算单
 * @since 2022/11/16 15:34 创建
 */
@RequestMapping("/construction/ShipSettle")
@Api(value = "工地系统", tags = "工地系统——工地结算单")
@RestController
public class ConstructionShipSettleController extends ControllerBase {

    @Autowired
    IShipSettleService settleSvc;
    @ApiOperation(value = "结算单查询数据接口", notes = "查询结算单")
    @RequestMapping(path = {"/{rowNum}","/{rowNum}/{page}"}, method = RequestMethod.POST)
    public WebResult querySettlePage(@RequestBody PageQuery query, @ApiParam("页面大小，为0时没有分页的临时数据，否则为正式结算单") @PathVariable int rowNum, @PathVariable(required = false) int page){
        try{
            var result = settleSvc.queryPageConstruction(query, rowNum, page);
            return success("ok", result);
        }
        catch (Exception ee){
            return error(ee);
        }
    }
}
